package org.travel.api.travel.dao.Lxf;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.travel.api.travel.pojo.Room;

import java.util.List;

public interface roomDao extends JpaRepository<Room,Integer>,JpaSpecificationExecutor<Room> {

    /**
     * 根据酒店编号查询该酒店中存在的房间
     * @param id
     * @return
     */
//    @Query("select r from Room r where r.hotelid =:id")
//    List<Room> getAllByHotelid(@Param("id") int id);

    /**
     * 根据酒店编号查询该酒店中存在的房间
     * @param id
     * @return
     */
    @Query("select r from Room r where r.hotel.hotelid = :id")
    List<Room> getAllByHotelid(@Param("id") int id);

}
